package com.longteng.lesson2.interceptor;


import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
public class InterceptorConfig extends WebMvcConfigurerAdapter {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        MyInterceptor myInterceptor =new MyInterceptor();
        //只要我在这里配置上拦截，那么所有的请求都会经过我的拦截器
        registry.addInterceptor(myInterceptor).addPathPatterns("/**")
        .excludePathPatterns("/form/view").excludePathPatterns("/login/login");
        super.addInterceptors(registry);
    }
}
